import 'package:card_swiper/card_swiper.dart';
import 'package:flutter/cupertino.dart';

class CardView extends StatefulWidget {
  const CardView({super.key});

  @override
  State<CardView> createState() => _CardViewState();
}

class _CardViewState extends State<CardView> {
  @override
  Widget build(BuildContext context) {
    return Swiper(
      itemBuilder: (BuildContext context,int index){
        return GestureDetector(
          onHorizontalDragUpdate: (details) {
            if (details.delta.dx > 0) {
              // Swiping right, ignore this gesture and let PageView handle it
              IgnorePointer(
                child: SwiperItem(), // Replace SwiperItem with your Swiper content
              );
            } else {
              // Swiping left, Swiper handles this gesture
              SwiperItem(); // Replace SwiperItem with your Swiper content
            }
          },
          child: SwiperItem(),
        );
        // return Image.network("https://via.placeholder.com/350x150",fit: BoxFit.fill,);
      },
      itemCount: 3,
      loop: false,
      pagination: const SwiperPagination(),
      control: const SwiperControl(),
    );
  }

  Widget SwiperItem(){
    return Image.network("https://via.placeholder.com/350x150",fit: BoxFit.fill,);
  }

}
